$(document).ready(function(){ 
var newInterval;
	
	//adds close and continue buttons
	$('#secret').append('<div class="closebox"></div>');
	//$('#follow-bird-prompt').append('<div class="closebox"></div>');
	//$('#secret').append('<div class="continueButton">Continue</div>');
	
	//opens secret window when character clicked
	$('#character').click(function() {
		$('#secret').show();
		
		//close box hides secret window
		$('.closebox').click(function() {
			$('#secret').hide();
		});
		
		//continue button hides secret window and launches animation + transition
		$('.continueButton').click(function() {
			$('#secret').hide();
			
			animateCharacter();
		});
	});
	
	//character animation
	function animateCharacter() {
	
	}
	
});

function chooseChar(){
	//fadeout characters
	$("#char2").fadeOut("slow");
	$("#char3").fadeOut("slow");
	$("#char4").fadeOut("slow");
	
	setTimeout("charOffScreen()", 1000);
}

function charOffScreen(){
	$("#directions").html(" ");
	newInterval= setInterval("moveChar()", 50);
}

//this shows the 'follow your bird pop out box'
function moveChar(){
	var left = parseInt($("#char1").css("left"));
	if(left < 200){
		left = left + 10;
		$("#char1").css("left", left);
	} else {
		clearInterval(newInterval);
		$('#follow-bird-prompt').show();
		//alert ("follow your bird then tap on it to get a secret!");
		$("#char1P").html('<img id="char1B" src="images/birdRight.gif" onclick="char1SecondClick()" />');
	}
}

//this hides the 'follow your bird' box and shows the secret box. 
function char1SecondClick(){
		$('#follow-bird-prompt').hide();
		$('#secret').show();
		$('#secret').append('<div class="continueButton"><a href="transition-1.html">Continue</a></div>');
	}